package com.example.zhangguoqing.homeofpet;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ListView;

import com.example.zhangguoqing.homeofpet.Info.ListViewAdapter;

import java.util.ArrayList;
import java.util.HashMap;

public class InfoFragment extends Fragment{

    Intent intent=new Intent();
    ArrayList<HashMap<String,Object>> arrayList;
    int pos=-1;

    ListViewAdapter listViewAdapter;
   ImageView imageView=null;
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {


        View view=LayoutInflater.from(getActivity()).inflate(R.layout.fragment_info,null);


        ListView listView=(ListView)view.findViewById(R.id.listView);



        listViewAdapter=new ListViewAdapter(view.getContext(),getData());

        listView.setAdapter(listViewAdapter);





        return view;
    }
    public void setMenuVisibility(boolean menuVisibile){
        super.setMenuVisibility(menuVisibile);
        if(this.getView()!=null){
            this.getView().setVisibility(menuVisibile?View.VISIBLE:View.GONE);
        }
    }

    private ArrayList<HashMap<String,Object>>getData(){
        arrayList=new ArrayList<HashMap<String, Object>>();
        HashMap<String,Object>hashMap1=new HashMap<String,Object>();
        HashMap<String,Object>hashMap2=new HashMap<String,Object>();
        HashMap<String,Object>hashMap3=new HashMap<String,Object>();
        hashMap1.put("image", R.mipmap.info_shoucang);
        hashMap1.put("itemName","我的收藏");

        arrayList.add(hashMap1);

        hashMap2.put("image", R.mipmap.info_wenti);
        hashMap2.put("itemName","常见问题");

        arrayList.add(hashMap2);

        hashMap3.put("image", R.mipmap.info_fankui);
        hashMap3.put("itemName","意见反馈");

        arrayList.add(hashMap3);

        return arrayList;

    }

}
